import time

from selenium.webdriver.common.by import By
from common.Utils import BlogDriver

class Blogdetail:
    url=""
    driver=""
    def __init__(self):
        self.url="http://8.137.19.140:9090/blog_detail.html?blogId=158477"
        self.driver=BlogDriver.driver
        self.driver.get(self.url)
        time.sleep(2)

    # 登录状态下的博客详情页的测试
    def DetailTestBylogin(self):
        print("博客详情页面登录状态下")
        time.sleep(5)
        #标题
        self.driver.find_element(By.CSS_SELECTOR,"body > div.container > div.right > div > div.title")
        #时间
        self.driver.find_element(By.CSS_SELECTOR,"body > div.container > div.right > div > div.date")
        #内容
        #self.driver.find_element(By.CSS_SELECTOR,"#detail")
        BlogDriver.getScreeShot()

        # 未登录状态下的博客详情页面测试
    def DetailTestFileLogin(self):
        #注销
        self.driver.find_element(By.CSS_SELECTOR,"body > div.nav > a:nth-child(6)").click()
        # 登录
        self.driver.find_element(By.CSS_SELECTOR, "body > div.container-login > div > h3")
        # 用户名
        self.driver.find_element(By.CSS_SELECTOR, "body > div.container-login > div > div:nth-child(2) > span")
        # 密码
        self.driver.find_element(By.CSS_SELECTOR, "body > div.container-login > div > div:nth-child(3) > span")
        # 提交
        self.driver.find_element(By.CSS_SELECTOR, "#submit")
        BlogDriver.getScreeShot()

# Detail=Blogdetail()


